<!DOCTYPE html>
<html>
<head>
    <title>社区问答</title>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css">
    <script src="/js/jquery/jquery.min.js"></script>
    <script src="/js/bootstrap/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="/css/reset.css"/>
    <link rel="stylesheet" href="/css/strategyCatalogs.css"/>
    <script src="/js/plugins/jrender/jrender.min.js"></script>
    <link rel="stylesheet" href="/js/plugins/dialog2/dialog.css"/>
    <script src="/js/plugins/dialog2/dialog.min.js"></script>
    <script src="/js/common.js"></script>
</head>

<body>
<div class="search-head">
    <div class="row nav-search">
        <div class="col-2">
            <a href="/mine/askQuestion.html">
                <span><i class="fa fa-chevron-left fa-2x"></i></span>
            </a>
        </div>
        <div class="col-10">
            <div class="input-group-sm search">
                <input class="form-control searchBtn" placeholder="搜索旅行攻略">
            </div>
        </div>
    </div>
</div>
<div class="container news">
    <span class="type">所有回复</span>
</div>
<HR style="FILTER: progid:DXImageTransform.Microsoft.Shadow(color:#987cb9,direction:145,strength:15)" width="80%"
    color=#987cb9 SIZE=1>

<div class="tab-content " id="pills-tabContent">
    <div id="comment">

        <div render-loop="question">
            <div class="container row comment">
                <div class="col-2 comment-head">
                    <img class="rounded-circle"
                         render-src="question.user.headImgUrl">
                </div>
                <div class="col comment-right">
                    <p class="authorName"><span render-html="question.user.nickName">dafei</span></p>
                    <span class="comment-date" render-html="question.createTime">2018-07-19</span>
                    <div class="comment-content">
                        <a href="#">
                            <p render-html="question.content"></p>
                        </a>
                    </div>

                    <div class="d-flex icon">
                        <a href="/mine/addQuestion.html?id=" render-fun="setHref" render-key="question.id">
                            &nbsp;&nbsp;&nbsp;<i class="fa  fa-commenting-o answer" style="margin-right: 10px">回复</i>
                        </a>
                    </div>
                </div>
            </div>
        </div>
        <div class="tab-pane fade show active" id="allAnswer">
            <div render-loop="answers">
                <div>
                    <hr>
                    <button class="btn" render-html="answers.user.nickName">dafei</button>
                    <p render-fun="setContent" render-key="answers.content"></p>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    $(function () {
        var params=getParams();
        if(params.id){
            var nbsp="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
            //获取当前提问及所有的回复
            $.get("/askQuestions/answer",{quesId:params.id},function (data) {
                console.log(data);
                //渲染当前问题
                $("#comment").renderValues(data,{
                    "setHref": function (item, value) {
                        $(item).attr("href", $(item).attr("href") + value)
                    }
                });
                //渲染所有的回复
                $("#allAnswer").renderValues(data,{
                    "setContent": function (item, value) {
                        $(item).html(nbsp+value);
                    }
                });
            });
        }
    })
</script>
</body>
</html>